System and method for caching

ABSTRACT

Systems and methods that cache are provided. In one example, a system may include a spatial cache system coupled to a processing unit and to a memory. The spatial cache system may be adapted to reduce the memory latency of the processing unit. The spatial cache system may be adapted to store prefetched blocks, each stored prefetched block including a plurality of cache lines. If a cache line requested by the processing unit resides in one of the stored prefetched blocks and does not reside in the processing unit, then the spatial cache system may be adapted to provide the processing unit with the requested cache line.

RELATED APPLICATIONS

This application makes reference to, claims priority to and claimsbenefit from U.S. Provisional Patent Application Ser. No. 60/409,256,entitled “System and Method for Controlling Prefetching” and filed onSep. 9, 2002; U.S. Provisional Patent Application Ser. No. 60/409,240,entitled “System and Method for Caching” and filed on Sep. 9, 2002; andU.S. Provisional Patent Application Ser. No. 60/409,361, entitled“System and Method for Directional Prefetching” and filed on Sep. 9,2002.

INCORPORATION BY REFERENCE

The above-referenced United States patent applications are herebyincorporated herein by reference in their entirety.

BACKGROUND OF THE INVENTION

In many fields and applications, a control processor (e.g., centralprocessing unit (CPU)) shares a memory with multiple devices via amemory controller. The CPU may, for example, handle interrupts, manageother functional resources and interact with users. To perform thesetasks in a timely manner, the execution speed of the CPU is asubstantial factor with respect to the overall system performance.Memory latency, in turn, is a substantial factor with respect to theexecution speed. Unlike media processors, for example, that accessmemory in long data streams, the CPU may tend to access short streams ofsequencing addresses. It is difficult to build a shared memory systemthat satisfies these different types of requests. Thus, the memorylatency of the CPU may be long (e.g., tens of cycles) even if the memorybandwidth is high.

One solution to the memory latency problem employs the technique ofprefetching. Prefetching may include, for example, loading particulardata to storage close to the CPU in anticipation that the CPU may usethe data in the near future.

In one conventional system, the CPU includes a level two (L2) cache.Such an approach may be costly and may negatively impact CPUperformance. The L2 cache typically accommodates large line sizes and,as a result, may be quite large in size and may necessitate a largecache bandwidth. When the CPU accesses line x, the L2 cache control mayprefetch the next sequential cache line x+1 into the L2 cache. Fetchingmore cache lines into the L2 cache may also increase capacity andbandwidth requirements. Furthermore, conventional L2 caches tend to keepcache lines that have already been accessed by the CPU under theassumption that the CPU may access the same cache lines in the future.Thus, conventional L2 caches are necessarily large in size and typicallytake up the most space in the CPU.

Another conventional system employs a stream buffer next to the cachesof the CPU. Such a system may be complicated and slow. Each streambuffer is a first-in-first-out (FIFO) storage of a fixed number of cachelines to hold a stream with sequentially increasing address of CPU data.Typically, multiple stream buffers are used. The stream buffers areadapted, for an access, to perform a search of all buffers and allentries of each buffer. Additionally, the stream buffers are adapted toshift the buffer entries to maintain the FIFO structure. However, theseadaptations may limit the overall capacity of the stream buffer andaccess time. Moreover, the stream buffer may not inherently be able tostore data streams that are striding in reversed order.

Further limitations and disadvantages of conventional and traditionalapproaches will become apparent to one of ordinary skill in the artthrough comparison of such systems with some aspects of the presentinvention as set forth in the remainder of the present application withreference to the drawings.

BRIEF SUMMARY OF THE INVENTION

Aspects of the present invention may be found, for example, in systemsand methods that provide caching. In one embodiment, the presentinvention may provide a system that caches data streams. The system mayinclude, for example, a spatial cache system coupled to a processingunit and to a memory. The spatial cache system may be adapted to reducememory latency of the processing unit. The spatial cache system may alsobe adapted to store prefetched blocks in which each stored prefetchedblock includes a plurality of cache lines. If a cache line requested bythe processing unit resides in one of the stored prefetched blocks anddoes not reside in the processing unit, then the spatial cache systemmay be adapted to provide the processing unit with the requested cacheline.

In another embodiment, the present invention may provide a method thatreduces memory latency between a memory and a control processor. Themethod may provide a spatial cache system that is coupled to the memoryand to the control processor. The spatial cache system may include, forexample, blocks stored in a spatial cache. The blocks may include, forexample, a plurality of cache lines. If a cache line requested by thecontrol processor does not reside in the control processor and doesreside in the spatial cache, then the spatial cache system may send therequested cache line to the control processor. If the cache linerequested by the control processor does not reside in the controlprocessor and does not reside in the spatial cache, then the spatialcache system may generate a missing block request and may generate aprefetch block request.

In yet another embodiment, the present invention may provide a methodthat reduces memory latency between a memory and a control processor. Ifa cache line miss occurs in the control processor, then a request forthe missed cache line from the control processor may be received. It maybe determined if the requested cache line resides in a spatial cache. Ifthe requested cache line does reside in the spatial cache, then therequested cache line may be sent to the control processor. If therequested cache line does not reside in the spatial cache, then amissing block request and a prefetch block request may be generated.

These and other features and advantages of the present invention may beappreciated from a review of the following detailed description of thepresent invention, along with the accompanying figures in which likereference numerals refer to like parts throughout.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows a block diagram illustrating an embodiment of a system thatcaches data streams according to the present invention

FIGS. 2A–2B show a flowchart illustrating an embodiment of a processthat caches data streams when a central processing unit (CPU) attemptsto read a particular cache line according to the present invention.

FIG. 3 shows a flowchart illustrating an embodiment of an invalidationprocess that may occur when a CPU attempts to write a modified cacheline back to a memory according to the present invention.

FIG. 4 shows an embodiment of a memory controller according to thepresent invention.

FIG. 5 shows a portion of an embodiment of a spatial cache systemaccording to the present invention.

DETAILED DESCRIPTION OF THE INVENTION

FIG. 1 shows a block diagram illustrating an embodiment of a system thatcaches data streams according to the present invention. The system 10may include, for example, a central processing unit (CPU) 20, a memorycontroller 30, a memory 40 and other system functional units 50. The CPU20 may also include, for example, a cache 60. The cache 60 may include,for example, a level one (L1) cache and a level two (L2) cache which maybe partitioned into cache lines. The memory controller 30 may include,for example, a spatial cache system 70 and a memory scheduler 80. TheCPU 20 may be coupled to the memory controller 30 which, in turn, may becoupled to the memory 40. The spatial cache system 70 and the otherfunctional units 50 may be coupled to the memory scheduler 80. Althoughthe spatial cache system 70 is illustrated as part of the memorycontroller 30, the spatial cache system 70 may be separate from thememory controller 30.

The spatial cache system 70 may include, for example, a spatial cacheand a set of controls that prefetch streams of data into the spatialcache system 70 to reduce the memory latency of the CPU 20. The controlof the spatial cache system 70 may be adapted for one or more of thefollowing: handling multiple misses sent from the CPU 20; prefetchingahead of the need by the CPU 20; invalidating lines as soon as the linesare used by the CPU 20; not expecting the CPU 20 to request the sameline again from the spatial cache system 70; and replacing prefetcheddata if the CPU 20 starts to access other streams.

The spatial cache system 70 may also be adapted for sending, forexample, one or more types of block requests to the memory 40. A blockmay include one or more cache lines. The spatial cache system 70 may beadapted to request a missing block from the memory 40 when, for example,a CPU cache line miss (i.e., the CPU 20 was unable to find a particularcache line in its cache 60) also misses the spatial cache system 70. Thespatial cache system 70 may also request a prefetch block from thememory 40 when, for example, a particular block is determined by thespatial cache system 70 to be needed by the CPU 20 ahead of the actualneed of the CPU 20.

FIGS. 2A–B show a flowchart illustrating an embodiment of a process thatcaches data streams when the CPU 20 attempts to read a particular cacheline according to the present invention. In step 90, the CPU 20 may belooking for a particular cache line (e.g., data in a particular cacheline) of the CPU cache 60.

In query 100, it may be determined whether the particular cache line ispresently in the CPU cache 60. If the particular cache line is presentlystored in the CPU cache 60 (i.e., if it is not a CPU cache miss), thenthe CPU may access (e.g., read) the particular cache line in step 110.The process may then, for example, loop back to step 90 in which the CPU20 may look for a CPU cache line (e.g., another CPU cache line). Inquery 100, if the particular cache line is not presently stored in theCPU cache 60 (i.e., if it is a CPU cache miss), then, in step 120, theCPU 20 may check the spatial cache system 70.

In query 130, it may be determined whether the particular cache line ispresently in the spatial cache system 70. If the particular cache lineis presently stored in the spatial cache system 70 (i.e., if it is not aspatial cache system miss), then, in step 140, the spatial cache system70 may send the particular cache line to the CPU 20. In addition, as anoption, the spatial cache system 70 may invalidate, delete or remove theparticular cache line in the spatial cache system 70 that was sent tothe CPU 20. The spatial cache system 70 may not expect, for example, theCPU 20 to request that particular cache line again in the near future.An invalidated cache line may become a more likely candidate forrefilling in the spatial cache system 70. However, although invalidated,a cache line may still be read again by the CPU 20. In one embodiment,the above-described option may be used, for example, if the block sizeof the spatial cache system 70 and an L1 line size are the same orapproximately the same. In subsequent step 110, the CPU 20 may access(e.g., read) the particular cache line residing in the spatial cachesystem 70. The process may then, for example, loop back to step 90 inwhich the CPU 20 may look for a cache line (e.g., another cache line) inthe CPU cache 60.

In query 130, if the particular cache line is not presently stored inthe spatial cache system 70 (i.e., if it is a spatial cache systemmiss), then, in step 150, the spatial cache system 70 may request amissing block from the memory 40. The requested missing block mayinclude, for example, one or more cache lines including the particularcache line that was missed. In one example, in step 160, the spatialcache system 70 may receive the requested missing block and may forwardthe particular cache line of the requested missing block to the CPU 20.In another example, the particular cache line of the requested missingblock may be directly forwarded to the CPU 20. In step 170, the spatialcache system 70 may store the remaining data (e.g., the cache linesother than the particular cache line) of the requested missing block inthe spatial cache system (e.g., in a spatial cache). In one example, thespatial cache system 70 may store the entire requested missing block in,for example, its spatial cache, but the spatial cache system 70 mayinvalidate, delete or remove the particular cache line forwarded to theCPU 20. In another example, the spatial cache system 70 may not storethe entire requested missing block, but instead may only store theremaining data of the requested missing block in the spatial cachesystem 70. In step 180, the spatial cache system 70 may request aprefetch block in light of the information relating to the missing blockrequest in preparation for a possible future need of the CPU 20. Forexample, the spatial cache system 70 may request the next sequentialblock before or after the requested missing block depending upon, forexample, a particular prefetch direction. In another example, thespatial cache system 70 may request a prefetch block that includes thenext sequential line before or after the particular cache line that wasmissed. In yet another example, the spatial cache system 70 may requesta prefetch block that may not be the next sequential block before orafter the requested missing block or that may not be the next sequentialline before or after the particular cache line that was missed. In someexamples, the prefetch block may not be requested until the missingblock request has been completed (e.g., the particular cache line thatwas missed has been sent to or received by the CPU 20). In someexamples, the spatial cache system 70 may not prefetch a block thatalready resides in the spatial cache system 70. In step 190, the spatialcache system 70 may store the prefetch block in the spatial cache system70 (e.g., in a spatial cache).

FIG. 3 shows a flowchart illustrating an embodiment of an invalidationprocess that may occur when the CPU 20 attempts to write a cache line(e.g., a modified cache line) back to the memory 40 according to thepresent invention. During the normal operation of the CPU 20, the CPU 20may modify some cache lines. At some point in time, the memory 40 may beupdated to reflect the modified cache line (e.g., a copy-back process).In one example, the write data including, for example, the modifiedcache line or addressing information and a write request are sent fromthe CPU 20 to the memory scheduler 80.

Although the memory 40 may be updated with the modified cache line fromthe CPU, the spatial cache system 70 may still be carrying an oldversion of the cache line (e.g., an unmodified cache line). In step 200,the CPU 20 may also send information (e.g., address information) aboutthe modified cache line to the spatial cache system 70. In query 210,the spatial cache system 70 may determine whether it is carrying (e.g.,stored in its spatial cache) an old version of the cache line. If an oldversion of the cache line is stored in the spatial cache system 70,then, in step 220, the spatial cache system 70 may invalidate, delete orremove the old version of the cache line that is stored in spatial cachesystem 70. In another example, if the old version of the cache line isstored in the spatial cache system 70, then the spatial cache system 70may invalidate, delete or remove the entire block containing the oldversion of the cache line that is stored in the spatial cache system 70.

The spatial cache system 70 may include at least one or more of thefollowing advantages. Compared to some types of conventional cache(e.g., the stream buffers), the spatial cache system 70 may make moreefficient use of its storage, particularly when the data streams maysometimes have variable lengths. In one embodiment, the spatial cachesystem 70 may make more efficient use of its storage when the datastreams are very likely to have variable lengths. In addition, thespatial cache system 70 may support a large number of data streams withlittle impact on access time. Furthermore, the spatial cache system 70may prefetch data streams with strides or jumps between accesses.

Compared to some types of conventional cache (e.g., a fully-functionalL2 cache), the spatial cache system 70 may not employ some temporalaspects of conventional caching. Some conventional cache may store andprotect data streams, which have been recently been used by the CPU 20,because the CPU 20 may reuse the data streams. On the other hand, in oneembodiment of the spatial cache system 70, any piece of prefetched datain the spatial cache system 70 used by the CPU 20 may be invalidated andreplaced by new streams of data. The spatial cache system 70 may bedesigned such that it assumes that the CPU 20 may not reuse, in the nearfuture, a particular cache line that the CPU 20 has already accessedfrom the spatial cache system 70. Since the spatial cache system 70 maynot invalidate previously accessed cache lines or may make suchpreviously accessed cache lines inaccessible, the spatial cache system70 may reuse the space occupied by the previously accessed cache linesor may designate the space occupied by the previously accessed cachelines as likely candidates for reuse (e.g., for refill). Thus, thecapacity of the spatial cache system 70 may be much smaller than thatof, for example, a fully functional L2 cache. Moreover, the spatialcache system 70 may not contain modified data. Thus, data that ismodified by the CPU 20 may be invalidated in a single cycle in thespatial cache system 70. Data coherency may also be achieved, forexample, by invalidating the entire spatial cache or an entire block inthe spatial cache of the spatial cache system 70. Accordingly, datacoherence between the CPU's read and write or between the CPU 20 andother devices can be easily maintained at no substantial impact on theperformance of the CPU 20.

FIG. 4 shows an embodiment of the memory controller according to thepresent invention. In the illustrated embodiment, the memory controller30 includes the spatial cache system 70. However, the present inventionalso contemplates the spatial cache system 70 being separate from thememory controller 30. The memory controller 30 may include, for example,a CPU interface 230, a selector 240, a read buffer 250, a prefetchcontroller 260, a selector 270, a spatial cache 280, a decision block310, a buffer 320, a prefetch request buffer (PRB) 330, a selector 360and the memory scheduler 80. The spatial cache 280 may include, forexample, a data array 290 and a directory 300 (e.g., a tag array). Thecomponents may be coupled as illustrated in FIG. 4. However, somecouplings have not been illustrated. For example, the CPU interface 230may be coupled to the CPU 20. The memory scheduler 80 may be coupled,for example, to the memory 40 and to other functional devices 50.

The spatial cache 280 may include, for example, a data array 290 and adirectory 300 (e.g., a tag array). The data array 290 may be adapted tostore data prefetched from the memory 40. The data array 290 may bearranged into blocks in which each block may store one or more cachelines. In one example, the line size of an L1 cache in the CPU 20 may be32 bytes and the block size of the spatial cache 280 may be 128 bytes.Thus, each block of the spatial cache 280 may store four cache lines.The directory 300 may be adapted to store the addresses of the data.Each entry in the directory 300 may include, for example, a blockaddress and several valid bits. In one example, each valid bit maycorrespond to each unit of cache line belonging to the same block. Forexample, a block in the spatial cache 280 may include four cache lines.Accordingly, there may be four valid bits, one valid bit for each blockin the directory 300. The block may be invalidated if, for example, allof its corresponding valid bits are in an off state. An invalidatedblock may become a likely candidate location for refilling futureprefetched data, although, in one embodiment, content may still beaccessed in the invalidated block. In one example, when a particularcache line in a particular block of the data array 290 is used by theCPU 20, the valid bit corresponding to the particular cache line may beset to an off state (i.e., an invalid state).

The PRB 330 may be adapted to store memory requests that are waiting tobe sent or that have been sent but not yet completed. The memoryrequests may include, for example, block address information. Statusbits may be used to indicate, for example, a valid request, a prefetchblock request, a missing block request, a request already sent tomemory, etc. The PRB 330 may include, for example, one or more datastructures. For example, the PRB 330 may include a queue 340 and a stack350. The queue 340 may be, for example, a first-in-first-out (FIFO)buffer that may store missing block requests. The stack 350 may be, forexample, a last-in-first-out (LIFO) buffer that may store prefetch blockrequests. The information for a new request may be placed in an entry inthe queue 340 or the stack 350 depending upon the type of request. Inone example, a missing block request may be placed at the back of thequeue 340 and a prefetch block request may be placed at the top of thestack 350. If the stack is full, the bottom entry may be deleted. Thebottom entry may represent the oldest prefetch block request received bythe PRB 330, but not yet sent out to the memory 40. The capacity of thequeue 340 and the stack 350 may be determined, for example, by themaximum number of CPU misses that the prefetch control may support. Thequeue 340 or the stack 350 may be a LIFO buffer, FIFO buffer or anyother type of buffer. The PRB 330 may also employ a single buffer thatmay store both missing block requests and prefetch block requests.

In operation, a CPU read request or a CPU write request may cause a lookup in the spatial cache 280. A CPU read request may be generated inresponse, for example, to an L1 cache miss or a non-cacheable read. Inone example, the CPU cache miss may result in a look up in the spatialcache 280. Non-cacheable read requests may be directly provided by thememory 40. In another example, the spatial cache 280 may stagenon-cacheable data as long as the software can maintain the datacoherency among the devices accessing the memory 40.

The look up in the spatial cache 280 may be passed from the CPU buffer230 to the prefetch controller 260. The prefetch controller 260 maydetermine whether or not the spatial cache 280 contains the missing CPUcache line. The prefetch controller 260 may, via the selector 270, useaddress information from the directory 300 in determining whether or notthe missing cache line is present in the data array 290. If the missingcache line is present in the data array 290, then the decision block 310may determine that it is a spatial cache hit and may send the missingcache line to the CPU 20 via the buffer 320, the selector 240 and theCPU interface 230. Once the particular cache line in the data array 290has been sent to the CPU 20, then the particular cache line in the dataarray 290 may be invalidated by, for example, setting a correspondingvalid bit within a respective block address to an off state.

In addition to sending the missing CPU cache line to the CPU 20, thespatial cache system 70 may also generate a prefetch request in light ofinformation concerning the missing cache line. For example, the spatialcache system 70 may check whether or not the next sequential blockbefore or after the block containing the missing cache line resides inthe spatial cache 280. If the spatial cache system 70 does not contain,for example, the next sequential block before or after the blockcontaining the missing cache line, then the spatial cache system 70 maygenerate a prefetch request (e.g., in the prefetch control 260 or in thePRB 330) and store it in PRB 330 (e.g., in the stack 350). The prefetchrequest may be transmitted to the memory scheduler 80 via the selector360 when it is popped from the stack 350. Priority may be given torequests stored in the missing request queue 340 over prefetch requestsstored in the stack 350.

If the look up in the spatial cache 280 shows that the missing cacheline is not in the spatial cache 280, then a spatial cache miss may haveoccurred. The spatial cache system 70 may then generate a missing blockrequest in which the requested missing block may contain the missing CPUcache line. The missing block request may be stored in the PRB 330(e.g., in the queue 340). Since the spatial cache system 70 may be ableto handle multiple miss requests, a particular missing block request mayhave to wait for its opportunity in the queue 340 to be transmitted tothe memory scheduler 80 via the selector 360. In addition to the missingblock request, the spatial cache system 70 may also generate a prefetchblock request. The prefetch block request may not be generated if theblock requested is already residing in the spatial cache 280. Therequested prefetch block may be the next sequential block before orafter the block in the missing block request. In one example, theprefetch block may be part of a set of blocks. The memory 40 may bepartitioned into sets of blocks. For example, a set of blocks mayinclude block b and block b+1 or block b and block b−1, in which b−1, band b+1 are block addresses in the memory 40. In one embodiment, blocksmay form a set of aligned blocks. For example, block b and block b+1 orblock b and block b−1 may be aligned blocks if the pair of blocksconstitutes a larger memory block that is twice as large. In oneembodiment, the block size is 64 bytes and an address (e.g., a memoryaddress) contained in 32 bits. The two blocks having the same bits 31 to8 of the address (i.e., address[31:8]) may be in the same set of alignedblocks. Bit 7 may have a value of 0 for one of the aligned blocks andbit 7 may have a value of 1 of the other block of the aligned blocks.Thus, the prefetch block request may depend upon which of the blocks ina set of aligned blocks is not the missing block. The prefetch blockrequest may be stored in the PRB 330 (e.g., in the stack 350). In oneexample, the prefetch block request may not be sent to the memoryscheduler 80 until the respective memory block request or any memoryblock request has been completed.

When the memory scheduler 80 fetches the requested missing block, themissing cache line may be sent to the CPU 20 via the read buffer 250,the selector 240 and the CPU interface 230. The rest of the data in therequested missing block (e.g., the other cache lines in the missingblock) may be refilled into the spatial cache 280. The valid bits ofthese lines may be turned on (i.e., be in a valid state). The valid bitcorresponding to the missing cache line sent to the CPU 20 may be turnedoff (i.e., cleared). In one example, the entire missing block is storedin the spatial cache 280, however, the cache line used by the CPU 20(which was sent to the CPU 20) may be invalidated (i.e., the valid bitcorresponding to the cache line used by the CPU 20 may be cleared). Thespatial cache system 70 may then remove the missing block request fromthe PRB 330.

When a prefetched block is returned to the spatial cache system 70 fromthe memory 40, the entire prefetched block may be stored in the spatialcache 280 and all the corresponding valid bits may be set to a validstate. Information carried by the prefetched block (or a requestedmissing block) may be referenced with respect to information stored inthe PRB 330. The respective memory request or an entry associated withthe respective memory request may be used to determine where in thespatial cache 280 to refill the block of data. For example, the PRB 330may include information relating to the least recently used block thatmay used to refill the block of data. After storing the data, the PRBentry may be removed.

A CPU write request may also result in a look up request in the spatialcache 280. During a write request, a write request and write data may besent directly to the memory scheduler 80. However, information about thewrite request may also be sent to spatial cache system 70 which maydetermine whether or not there is a write hit in the spatial cache 280(i.e., whether the cache line being written to the memory 40 alreadyresides in a block of the spatial cache 280). If the cache line residesin the spatial cache 280 then, since it may be an older version of thecache line being written to the memory 40, it may be invalidated. Thespatial cache system 70 may invalidate the cache line or the entireblock containing the cache line. If a write miss occurs (i.e., the cacheline being written does not reside in the spatial cache 280), then therequest may be completed.

Some embodiments of the spatial cache system 70 may employ leastrecently used (LRU) bits. One or more LRU bits may be associated witheach block in the data array 290. If a read request from the CPU hits ablock in the spatial cache 280, for example, corresponding to blockaddress b, the requested L1 cache line in the block may be returned tothe CPU. The LRU bit associated with the block may not be updated;however, the valid bit associated with the line in this block may becleared. A block with all its valid bits cleared may be a candidatelocation for the next replacement as indicated by the LRU bit associatedwith the block.

FIG. 5 shows a portion of an embodiment of the spatial cache system 70according to the present invention. The spatial cache system 70 may beorganized in a two-way set associative arrangement and the replacementmay be controlled under an LRU replacement algorithm. The spatial cache280 is shown with the tag array 300 and the data array 290 andillustrates an addressing scheme in the spatial cache 280. Thequantities and numbering schemes are for illustration purposes only.Four streams a, b, c, d of various lengths are residing in the spatialcache 280 at the same time. A block may be placed in the spatial cache280 according to particular bits of the set bits, for example,set_ID[9:7] of the access addresses to the block and the LRU bit of theset. When a block is first placed in the spatial cache 280, its statusmay be that of most recently used (MRU). The block that is a candidatefor replacement may be the LRU in the set. When all the cache lines in aparticular block are sent to the CPU 20, the block may be invalidatedand the invalidated block may become the LRU.

While the present invention has been described with reference to certainembodiments, it will be understood by those skilled in the art thatvarious changes may be made and equivalents may be substituted withoutdeparting from the scope of the present invention. In addition, manymodifications may be made to adapt a particular situation or material tothe teachings of the present invention without departing from its scope.Therefore, it is intended that the present invention not be limited tothe particular embodiment disclosed, but that the present invention willinclude all embodiments falling within the scope of the appended claims.

1. A system for caching data streams, comprising: a spatial cache systemcoupled to a processing unit and to a memory, wherein: the spatial cachesystem is adapted to generate block requests for prefetched blocks andstore prefetched blocks, each prefetched block comprising a plurality ofcache lines; and the spatial cache system comprises: a prefetch control;a spatial cache; and a prefetch request buffer comprising a missingrequest gueue and a prefetch request stack that is separate from themissing request queue.
 2. The system according to claim 1, wherein thespatial cache system is adapted to provide the processing unit with acache line requested by the processing unit, the requested cache linenot residing in one of the stored prefetched blocks and not residing inthe processing unit.
 3. The system according to claim 2, wherein, if therequested cache line does not reside in the spatial cache system, thenthe spatial cache system is adapted to generate a missing block request,the requested missing block comprising a plurality of cache linesincluding the requested cache line.
 4. The system according to claim 3,wherein, if the requested cache line does not reside in the spatialcache system, then the spatial cache system is adapted to generate aprefetch block request, the requested prefetch block comprising a blockwith a block address that is sequentially related to a block address ofthe requested missing block.
 5. The system according to claim 3,wherein, if the requested cache line does not reside in the spatialcache system, then the spatial cache system is adapted to generate aprefetch block request, the requested prefetch block comprising aparticular block of a set of aligned blocks, the set comprising therequested missing block and the particular block.
 6. The systemaccording to claim 3, wherein the spatial cache system is adapted toreceive the requested missing block and adapted to send the requestedcache line to the processing unit.
 7. The system according to claim 6,wherein one or more cache lines other than the requested cache line ofthe requested missing block are stored in the spatial cache system andcan be used by the processing unit.
 8. The system according to claim 1,wherein, if a cache line requested by the processing unit resides in oneof the stored prefetched blocks and does not reside in the processingunit, then the spatial cache system is adapted to generate a prefetchblock request unless the requested prefetch block already resides in thespatial cache system, the requested prefetch block having a blockaddress that is sequentially related to a block address of the storedprefetch block comprising the requested cache line.
 9. The systemaccording to claim 1, wherein the spatial cache system is adapted toinvalidate a cache line, residing in the spatial cache system, to bewritten into the memory by the processing unit.
 10. The system accordingto claim 9, wherein the cache line residing in the spatial cache systemis an older version of the cache line to be written into the memory bythe processing unit.
 11. The system according to claim 1, wherein thespatial cache system is adapted to invalidate a block stored in thespatial cache system, the block comprising a cache line to be writteninto the memory by the processing unit.
 12. The system according toclaim 1, wherein the prefetch control is coupled to the spatial cache,the spatial cache is coupled to the prefetch request buffer, and theprefetch request buffer comprises at least one queue for outgoingprefetch request messages.
 13. The system according to claim 12, whereinthe spatial cache comprises: a data array, at least a portion of whichis arranged into blocks, each of which comprises a plurality of cachelines; and a directory that comprises addresses of the blocks.
 14. Thesystem according to claim 1, wherein when the prefetch request stack isfull, the prefetch request stack is adapted to delete the oldest entryin the prefetch request stack to make room for a newest entry in theprefetch request stack.
 15. The system according to claim 1, wherein themissing request queue comprises a first-in-first-out (FIFO) buffer. 16.The system according to claim 1, wherein the prefetch request stackcomprises a last-in-first-out (LIFO) buffer.
 17. The system according toclaim 1, wherein the spatial cache system is adapted to handle aplurality of prefetch block requests and missing block requests.
 18. Thesystem according to claim 1, wherein the spatial cache system is adaptednot to allow the requested cache line to be reused.
 19. The systemaccording to claim 1, wherein the spatial cache system is adapted tomake a space comprising the requested cache line a more likely candidateto be refilled.
 20. The system according to claim 1, wherein the spatialcache system is adapted to prefetch a particular block of a set ofaligned blocks.
 21. The system according to claim 20, wherein the setcomprises a particular block and one of a first block and a secondblock, the first block residing in the spatial cache system andcomprising the cache line requested by the processing unit, the secondblock not residing in the spatial cache system and comprising the cacheline requested by the processing unit.
 22. A method for reducing memorylatency between a memory and a control processor, comprising: providinga spatial cache system that is coupled to the memory and to the controlprocessor, the spatial cache system comprising blocks stored in aspatial cache, the blocks comprising a plurality of cache lines; if acache line requested by the control processor does not reside in thecontrol processor and does reside in the spatial cache, then the spatialcache system sends the requested cache line to the control processor;and if the cache line requested by the control processor does not residein the control processor and does not reside in the spatial cache, thenthe spatial cache system generates a missing block request and generatesa prefetch block request, wherein: each of the missing block and theprefetch block comprise a plurality of cache lines; the spatial cachesystem generates the missing block request by, at least in part, storingthe missing block request in a missing request Queue; and the spatialcache system generates the prefetch block request by, at least in part,storing the prefetch block request in a prefetch request stack that isseparate from the missing request queue.
 23. The method according toclaim 22, wherein the missing block request requests to fetch a missingblock that comprises the requested cache line.
 24. The method accordingto claim 23, wherein the prefetch block request requests to fetch aprefetch block having a block address that is sequentially related to ablock address of the missing block.
 25. The method according to claim22, further comprising: receiving a missing block from the memory inresponse to the missing block request; sending the requested cache lineof the missing block to the control processor; and storing cache linesother than the requested cache line of the missing block in the spatialcache.
 26. The method according to claim 22, further comprising:receiving a missing block from the memory in response to the missingblock request; sending the requested cache line of the missing block tothe control processor; storing the missing block in the spatial cache;and making the requested cache line stored in the spatial cacheinaccessible to the control processor after the requested cache line hasbeen sent to the control processor.
 27. The method according to claim22, comprising: invalidating a particular cache line residing in thespatial cache if an updated version of the particular cache line is tobe written into the memory by the control processor.
 28. The methodaccording to claim 22, comprising: if the cache line requested by thecontrol processor does not reside in the control processor and doesreside in the spatial cache, then the spatial cache system sends therequested cache line to the control processor and no longer makes therequested cache line in the spatial cache available to the controlprocessor.
 29. The method according to claim 22, comprising: if thecache line requested by the control processor does not reside in thecontrol processor and does reside in the spatial cache, then the spatialcache system sends the requested cache line to the control processor andindicates that a space in which the requested cache line resided is amore likely candidate to be refilled.
 30. A method, in a spatial cachesystem, for reducing memory latency between a memory and a controlprocessor, the method comprising: if a cache line miss occurs in thecontrol processor, then receiving a request for the missed cache linefrom the control processor; determining if the requested cache lineresides in a spatial cache; if the requested cache line does reside inthe spatial cache, then sending the requested cache line to the controlprocessor; and if the requested cache line does not reside in thespatial cache, then generating a missing block request and a prefetchblock request, wherein each of the missing block and the prefetch blockcomprise a plurality of cache lines; and prefetching a particular blockof a set of aligned blocks, wherein the set of aligned blocks comprisesthe particular block and one of a first block and a second block, thefirst block residing in the spatial cache and comprising the requestedcache line, the second block not residing in the spatial cache andcomprising the requested cache line.
 31. The method according to claim30, wherein the missing block request requests to fetch a missing blockthat comprises the requested cache line.
 32. The method according toclaim 31, wherein the prefetch block request requests to fetch aprefetch block having a block address that is sequentially related to ablock address of the missing block.
 33. The method according to claim31, comprising: receiving a missing block from the memory in response tothe missing block request; sending the requested cache line of themissing block to the control processor; and storing cache lines otherthan the requested cache line of the missing block in the spatial cache.34. The method according to claim 30, comprising: receiving a missingblock from the memory in response to the missing block request; sendingthe requested cache line of the missing block to the control processor;storing the missing block in the spatial cache; and making the requestedcache line stored in the spatial cache inaccessible to the controlprocessor after the requested cache line has been sent to the controlprocessor.
 35. The method according to claim 30, further comprising:invalidating a particular cache line residing in the spatial cache if anupdated version of the particular cache line is to be written into thememory by the control processor.
 36. The method according to claim 30,further comprising: if the requested cache line does reside in thespatial cache, then after sending the requested cache line to thecontrol processor making the requested cache line in the spatial cacheno longer available to the control processor.
 37. The method accordingto claim 30, further comprising: if the requested cache line does residein the spatial cache, then after sending the requested cache line to thecontrol processor, making a space in which the requested cache lineresided a more likely candidate to be refilled.
 38. The method accordingto claim 30, wherein generating a missing block request comprisesstoring the missing block request in a missing request queue.
 39. Themethod according to claim 30, wherein generating a prefetch blockrequest comprises storing the prefetch block request in a prefetchrequest stack.
 40. The method according to claim 30, wherein theprefetch request stack comprises a last-in-first-out (LIFO) buffer.